<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui">
    <h:head>
        <title>Master Production Schedule (Daily)</title>
    </h:head>
    <h:form prependId="false">
        <p:growl id="notif" showDetail="true"/>  
       <h:body>
            <f:view beforePhase="#{UserDisplayManagedBean.initView}">
                <f:view beforePhase="#{MPSDailyManagedBean.initView}">
                    <!-- IDLE DIALOG for -->
                    <p:confirmDialog message="You have been idle for 5 minutes. Do you want to continue?"  
                                     showEffect="bounce" hideEffect="explode"  
                                     header="Warning message" severity="alert" widgetVar="confirmation">  
                        <p:commandButton value="Yes" onclick="confirmation.hide()" type="button" /> 
                        <p:commandButton value="No" update="panel" oncomplete="confirmation.hide()"  
                                         actionListener="#{UserManagedBean.doLogout}" /> 
                    </p:confirmDialog>

                    <p:idleMonitor timeout="300000" onidle="confirmation.show()" />  
                    <!--END OF IDLE DIALOG-->
                    <div id="header">
                        <h:graphicImage value="/image/newHeader.jpg"/>
                    </div>

                    <div id="content">
                        <table>
                            <tr>
                                <td style="vertical-align:top">
                                    <p:toolbar style="background-color:darkred;font-size:90%;height:35px;width:100%"> 
                                        <p:toolbarGroup align="right">
                                            <p:button title="Home" image="ui-icon-home" outcome="ManufacturingDeptWorkspace"/>
                                            <p:button title="Notes" image="ui-icon-note"/>
                                            <p:button title="Mail" image="ui-icon-mail-closed"/>
                                            <p:button title="Edit Preferences" image="ui-icon-gear"/>
                                            <p:button title="Help" image="ui-icon-help"/>
                                            <p:commandButton immediate="true" type="submit" image="ui-icon-close" actionListener="#{UserManagedBean.doLogout}"/> 
                                        </p:toolbarGroup>
                                    </p:toolbar>

                                    <p:menu id="menu" style=" width:205px;height: 855px;font-family: Verdana;border-style: double;font-size: 80%">  
                                        <p:submenu label="Manufacturing Menu">  
                                            <p:menuitem value="Manufacturing Dept Home" url="http://localhost:8080/MerlionERP-war/MRP/ManufacturingDeptWorkspace.xhtml" ajax="false" icon="ui-icon ui-icon-home"/>  
                                        </p:submenu>
                                        <p:submenu label="Production Planning">
                                            <p:menuitem value="View Sales Record" url="http://localhost:8080/MerlionERP-war/MRP/SalesRecord.xhtml" ajax="false" icon="ui-icon ui-icon-search"/>  
                                            <p:menuitem value="View Sales Forecast" url="http://localhost:8080/MerlionERP-war/MRP/SalesForecast.xhtml" ajax="false" icon="ui-icon ui-icon-search" />
                                            <p:menuitem value="View Sales and Operation Plan" url="http://localhost:8080/MerlionERP-war/MRP/SalesAndOperationPlan.xhtml" ajax="false" icon="ui-icon ui-icon-search" />
                                        </p:submenu>
                                        <p:submenu label="Master Production Schedule">
                                            <p:menuitem value="View MPS Weekly" url="http://localhost:8080/MerlionERP-war/MRP/MasterProductionScheduleWeekly.xhtml" ajax="false" icon="ui-icon ui-icon-search" />
                                            <p:menuitem value="View MPS Daily" url="http://localhost:8080/MerlionERP-war/MRP/MasterProductionScheduleDaily.xhtml" ajax="false" icon="ui-icon ui-icon-search" />
                                            <p:menuitem value="Commit MPS" url="http://localhost:8080/MerlionERP-war/MRP/CommitMasterProductionSchedule.xhtml" ajax="false" icon="ui-icon ui-icon-search" />
                                        </p:submenu>
                                        <p:submenu label="Material Planning">
                                            <p:menuitem value="View Requirement Planning" url="http://localhost:8080/MerlionERP-war/MRP/MaterialRequirementPlanning.xhtml" ajax="false" icon="ui-icon ui-icon-search" />
                                        </p:submenu>
                                        <p:submenu label="Bill of Materials">
                                            <p:menuitem value="View Bill of Materials" url="http://localhost:8080/MerlionERP-war/MRP/BillOfMaterials.xhtml" ajax="false" icon="ui-icon ui-icon-search" />
                                        </p:submenu>
                                         <p:submenu label="Production Execution">
                                            <p:menuitem value="Production Execution" url="http://localhost:8080/MerlionERP-war/MRP/ProductionExecution.xhtml" ajax="false" icon="ui-icon ui-icon-search" />
                                        </p:submenu>
                                    </p:menu>

                                    <p:calendar mode="inline" style="font-size:11px;font-family:Tahoma"/>
                                </td>

                                <td style=" vertical-align: top">
                                    <h:graphicImage value="daily.jpeg" title="Daily" style="width:45px;height:35px" />
                                    <h:outputText value="         "/>
                                    <h:outputText value="Master Production Schedule" style="font-family:Tahoma;font-size:20px;font-weight:bolder"/>
                                    <p:spacer width="100" height="10"/>

                                    <p:panel id="panel" style=" font-family: Tahoma;width:1122px;height:1020px">
                                        <h:panelGrid columns="3">
                                            <h:outputText value="Year"/>
                                            <p:inputText id="Year" maxlength="4" value="#{MPSDailyManagedBean.selectedYear}" required="true"/>
                                            <p:message for="Year"/>

                                            <h:outputText value="Month"/>
                                            <h:selectOneMenu id="Month" value="#{MPSDailyManagedBean.selectedMonth}" required="true">
                                                <f:selectItem itemValue="" itemLabel="Select Month"/>
                                                <f:selectItem itemValue="1" itemLabel="January"/>
                                                <f:selectItem itemValue="2" itemLabel="February"/>
                                                <f:selectItem itemValue="3" itemLabel="March"/>
                                                <f:selectItem itemValue="4" itemLabel="April"/>
                                                <f:selectItem itemValue="5" itemLabel="May"/>
                                                <f:selectItem itemValue="6" itemLabel="June"/>
                                                <f:selectItem itemValue="7" itemLabel="July"/>
                                                <f:selectItem itemValue="8" itemLabel="August"/>
                                                <f:selectItem itemValue="9" itemLabel="September"/>
                                                <f:selectItem itemValue="10" itemLabel="October"/>
                                                <f:selectItem itemValue="11" itemLabel="November"/>
                                                <f:selectItem itemValue="12" itemLabel="December"/>
                                            </h:selectOneMenu>
                                            <p:message for="Month"/>

                                            <h:outputText value="Week"/>
                                            <h:selectOneMenu id="Week" value="#{MPSDailyManagedBean.selectedWeek}" required="true">
                                                <f:selectItem itemValue="" itemLabel="Select Week"/>
                                                <f:selectItem itemValue="1" itemLabel="1"/>
                                                <f:selectItem itemValue="2" itemLabel="2"/>
                                                <f:selectItem itemValue="3" itemLabel="3"/>
                                                <f:selectItem itemValue="4" itemLabel="4"/>
                                                <f:selectItem itemValue="5" itemLabel="5"/>
                                                <f:selectItem itemValue="6" itemLabel="6"/>
                                            </h:selectOneMenu>
                                            <p:message for="Week"/>

                                            <p:commandButton update="panel childPanel1 childPanel2 childPanel3 childPanel4" value="Generate Daily MPS" immediate="false" type="submit" actionListener="#{MPSDailyManagedBean.doGenerateDailyMPS}" />
                                        </h:panelGrid>

                                        <p:spacer style="border-top-style:groove " height="20px" width="880px"/><br/>
                                        <h:outputText value ="#{MPSDailyManagedBean.name1}"/>
                                        <p:dataTable id="childPanel1" value="#{MPSDailyManagedBean.MPSList1}"
                                                     var="MPS1" style=" font-family: Tahoma;width:700px; font-size: 80%" >

                                            <p:column headerText="Date">
                                                <h:outputText value ="#{MPS1.execDate}"/>
                                            </p:column>

                                            <p:column headerText="Monthly Demand"> 
                                                <h:outputText value="#{MPS1.monthlyDemand}" />
                                            </p:column>

                                            <p:column headerText="#WorkingDays/month"> 
                                                <h:outputText value="#{MPS1.nWorkdaysInMonth}" />
                                            </p:column>

                                            <p:column headerText="Daily Demand"> 
                                                <h:outputText value="#{MPS1.dailyDemand}" />
                                            </p:column>                   
                                        </p:dataTable>

                                        <p:spacer height="10px" width="880px"/><br/>
                                        <h:outputText value ="#{MPSDailyManagedBean.name2}"/>
                                        <p:dataTable id="childPanel2" value="#{MPSDailyManagedBean.MPSList2}"
                                                     var="MPS2" style=" font-family: Tahoma;width:700px; font-size: 80%" >

                                            <p:column headerText="Date">
                                                <h:outputText value ="#{MPS2.execDate}"/>
                                            </p:column>

                                            <p:column headerText="Monthly Demand">
                                                <h:outputText value="#{MPS2.monthlyDemand}" />
                                            </p:column>

                                            <p:column headerText="#WorkingDays/month"> 
                                                <h:outputText value="#{MPS2.nWorkdaysInMonth}" />
                                            </p:column>

                                            <p:column headerText="Daily Demand">
                                                <h:outputText value="#{MPS2.dailyDemand}" />
                                            </p:column>                                         
                                        </p:dataTable>

                                        <p:spacer height="10px" width="880px"/><br/>
                                        <h:outputText value ="#{MPSDailyManagedBean.name3}"/>
                                        <p:dataTable id="childPanel3" value="#{MPSDailyManagedBean.MPSList3}"
                                                     var="MPS3" style=" font-family: Tahoma;width:700px; font-size: 80%">

                                            <p:column headerText="Date">
                                                <h:outputText value ="#{MPS3.execDate}"/>
                                            </p:column>

                                            <p:column headerText="Monthly Demand">
                                                <h:outputText value="#{MPS3.monthlyDemand}" />
                                            </p:column>

                                            <p:column headerText="#WorkingDays/month">
                                                <h:outputText value="#{MPS3.nWorkdaysInMonth}" />
                                            </p:column>

                                            <p:column headerText="Daily Demand">
                                                <h:outputText value="#{MPS3.dailyDemand}" />
                                            </p:column>
                                        </p:dataTable>

                                        <p:spacer height="10px" width="880px"/><br/>
                                        <h:outputText value ="#{MPSDailyManagedBean.name4}"/>
                                        <p:dataTable id="childPanel4" value="#{MPSDailyManagedBean.MPSList4}"
                                                     var="MPS4" style=" font-family: Tahoma;width:700px; font-size: 80%" >

                                            <p:column headerText="Date">
                                                <h:outputText value ="#{MPS4.execDate}"/>
                                            </p:column>

                                            <p:column headerText="Monthly Demand"> 
                                                <h:outputText value="#{MPS4.monthlyDemand}" />
                                            </p:column>

                                            <p:column headerText="#WorkingDays/month"> 
                                                <h:outputText value="#{MPS4.nWorkdaysInMonth}" />
                                            </p:column>

                                            <p:column headerText="Daily Demand"> 
                                                <h:outputText value="#{MPS4.dailyDemand}" />
                                            </p:column>                                     
                                        </p:dataTable>

                                    </p:panel>
                                </td>
                            </tr>
                        </table>
                    </div>

                    <div id="footer">
                        <h:graphicImage value="../image/merlionfooter.jpg"/>
                    </div>
                </f:view>
            </f:view>
        </h:body>
    </h:form>
</html>

